// 在 pages/api/proxy.js
import axios from 'axios';



export async function GET(request: Request) {
    const { searchParams } = new URL(request.url);
    const ak = searchParams.get('ak') || 'defaultAk';
    const sk = searchParams.get('sk') || 'defaultSk';  // 注意这里之前是 searchParams.get('ak') 应该是 'sk'
    const url = 'https://superhelper.bce.baidu.com/api/idp/v1/accessToken/get?ak=' + ak + '&sk=' + sk;

    const config = {
        headers: {
            Referer: 'https://superhelper.bce.baidu.com/platform/store/gpts/detail?id=276&agentId=6354&limit_model=1'
        }
    };

    const response = await axios.get(url, config);
    return Response.json(response.data);

}